package com.awa.usercenter.service.impl;

import com.awa.usercenter.mapper.UserMapper;
import com.awa.usercenter.model.domain.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class sysUserDetailsService implements org.springframework.security.core.userdetails.UserDetailsService {
    //根据用户名查找用户
    @Autowired
    private UserMapper userMapper;
    @Override
    public UserDetails loadUserByUsername(String phoneNumber) throws UsernameNotFoundException {
        log.info("根据手机号查找用户=====>{}",phoneNumber);
        User user = userMapper.selectByPhone(phoneNumber);
        log.info("根据手机号查找用户=====>{}",user);
        return user;
    }
}
